
#ifndef __SYSDEF_H__
#define __SYSDEF_H__

#define OS_WAIT_FOREVER 0x00000000

typedef int OSStatus;

#define UNUSED(x)   (void)(x)
#define ARR_SIZE(a) (sizeof(a)/sizeof(a[0]))

typedef enum {
    OS_TLS_ID_ERRNO = 0,
    OS_TLS_ID_CWD,
    OS_TLS_ID_MAX = 16
} os_tls_id_e;

/**
 * container_of - return the member address of ptr, if the type of ptr is the
 * struct type.
 */
#define container_of(ptr, type, member) \
    ((type *)((char *)(ptr) - (unsigned long)(&((type *)0)->member)))

#if CONFIG_CONSOLE_LOG
#include <stdio.h>
extern char * debug_get_short_file_name(char * file_name);
#define	__MY_FILE__   debug_get_short_file_name(__FILE__)
#define assert_msg()  printf("[%s, %s, %d] system crash !!!\r\n", __MY_FILE__, __FUNCTION__, __LINE__);
#else
#define assert_msg()
#endif

#define ASSERT(x)			do 							\
                            {							\
                                if( !(x) )              \
                                {                       \
                                    assert_msg();		\
                                    while(!(x));		\
                                }                       \
                            } while( 1==0 )

#endif
